package com.kede.app.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.sql.Timestamp;

/**
* @description /
* @author Pr.li
* @date 2023-07-01
**/
@Entity
@Data
@Table(name="t_recy_area_phone")
@EntityListeners(AuditingEntityListener.class)
public class RecyAreaPhone implements Serializable {
    /**
    * 
    */
    @ApiModelProperty(value = "id")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    private Integer id;
    /**
    * 地区编号
    */
    @ApiModelProperty(value = "地区编号")
    @Column(name = "`area_code`")
    @NotNull(message = "areaCode不可为空")
    private Integer areaCode;


    @ApiModelProperty(value = "地区名称")
    @Column(name = "`area_name`")
    private String areaName;

    /**
    * 联系电话
    */
    @NotNull(message = "联系电话不可为空")
    @ApiModelProperty(value = "联系电话")
    @Column(name = "`phone`")
    private String phone;
    /**
    * 联系人
    */
    @ApiModelProperty(value = "联系人")
    @Column(name = "`phone_name`")
    @NotNull(message = "联系人不可为空")
    private String phoneName;
    /**
    * 
    */
    @ApiModelProperty(value = "createTime")
    @CreatedDate
    @Column(name = "`create_time`")
    private Timestamp createTime;
    /**
    * 
    */
    @ApiModelProperty(value = "updateTime")
    @Column(name = "`update_time`")
    @LastModifiedDate
    private Timestamp updateTime;
    /**
    * 
    */
    @ApiModelProperty(value = "createBy")
    @Column(name = "`create_by`")
    @CreatedBy
    private String createBy;
    /**
    * 
    */
    @ApiModelProperty(value = "updateBy")
    @Column(name = "`update_by`")
    @LastModifiedBy
    private String updateBy;

    public void copy(RecyAreaPhone source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
